local skel = fk.CreateSkill{
  name = "kqf__manyin",
}

Fk:loadTranslationTable{
  ["kqf__manyin"] = "蔓引",
  [":kqf__manyin"] = "每轮限一次，一名角色回合开始时，你可令至其距离不大于1的任意名角色摸两张牌并横置，然后这些角色获得“谋诛”。",

  ["#kqf__manyin_ask"] = "蔓引：你可以令至 %src 距离不大于1的任意名角色摸两张牌并横置，然后这些角色获得“谋诛”",

  ["$kqf__manyin1"] = "可怜东篱含蕾树，孤影落秋风。",
  ["$kqf__manyin2"] = "西风落，西风落，宫墙不堪破。",

}

skel:addEffect(fk.EventPhaseStart, {
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(skel.name) and player:usedEffectTimes(skel.name, Player.HistoryRound) < 1 and
      target.phase == Player.Start and (not target.dead) and table.find(target.room:getOtherPlayers(target, false), function (p)
        return p:distanceTo(target) <= 1 and not p.chained
      end)
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    local targets = table.filter(room.alive_players, function(p)
      return p:distanceTo(target) <= 1 and not p.chained
    end)
    local to = room:askToChoosePlayers(player, {
      targets = targets,
      min_num = 1,
      max_num = 999,
      prompt = "#kqf__manyin_ask:"..target.id,
      skill_name = skel.name,
    })
    if #to > 0 then
      event:setCostData(self, to)
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local to = event:getCostData(self)
    if to then
      room:sortByAction(to)
      for _,p in ipairs(to) do
        p:drawCards(2,skel.name)
        p:setChainState(true)
      end
      for _,p in ipairs(to) do
        room:handleAddLoseSkills(p, "kqf__mouzhu")
      end
    end
  end,
})

return skel